package com.bluenave.crm.core.domain;

import org.hibernate.annotations.ForeignKey;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Set;

/**
 * Created by IntelliJ IDEA.
 * User: aleksanderbrancewicz
 * Date: 7/25/11
 * Time: 10:20 PM
 * To change this template use File | Settings | File Templates.
 */

@Entity
public class Company implements Serializable{

    private int id;
    private String name = null;
    private String description = null;
    private Set<Person> employees = null;

    //Imposed by Hibernate should be never used by the application
    public Company() {
    }


    public Company(String name, String description) {
        this.name = name;
        this.description = description;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY )
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @OneToMany(mappedBy = "company", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    public Set<Person> getEmployees() {
        return employees;
    }

    public void setEmployees(Set<Person> employees) {
        this.employees = employees;
    }
}
